package com.mcptt.config.ue.initial.sub.sub;

import java.util.List;

import org.jdom.Element;
import org.jdom.JDOMException;

import com.cloudptt.api.product.log.Log;
import com.mcptt.config.ue.initial.sub.sub.sub.Service;
import com.mcptt.config.ue.initial.sub.sub.sub.VPLM;

public class HPLM {
	public static final String Name = "HPLM";
	private static final String Name_Plmn = "PLMN";
	
	private String plmn = null;
	private Service service = null;
	private VPLM vplm = null;
	
	public void parse(Element elem) throws JDOMException
	{
		if(elem == null)
		{
			return;
		}
		plmn = elem.getAttributeValue(Name_Plmn);
		List<Element> list = elem.getChildren();//��ø��ڵ���ӽڵ�  
		for(Element subElem:list) 
		{
			String name = subElem.getName();
			Log.debug(this.getClass(), "name = " + name);
			
			if(name == null
					|| name.length() <= 0)
			{
				return;
			}
			if(name.equals(Service.Name))
			{
				service = new Service();
				service.parse(subElem);
			}
			else if(name.equals(VPLM.Name))
			{
				vplm = new VPLM();
				vplm.parse(subElem);
			}
		}  
	}
	public String toString()
	{
		StringBuffer strBuf = new StringBuffer("\r\n");
		strBuf.append("<").append(Name).append(" ").append(Name_Plmn).append("=\"").append(plmn).append("\">");
		strBuf.append(service);
		strBuf.append(vplm);
		strBuf.append("</").append(Name).append(">");

		return strBuf.toString();
	}
}
